package com.sagframe.sagacity.sqltoy.plus.chain.query;

import com.sagframe.sagacity.sqltoy.plus.chain.ChainDao;
import com.sagframe.sagacity.sqltoy.plus.conditions.segments.MergeSegments;
import com.sagframe.sagacity.sqltoy.plus.conditions.toolkit.SqlStringUtil;

import java.util.concurrent.atomic.AtomicInteger;

public class QueryChainWrapper<T> extends AbstractChainQueryWrapper<T, String, QueryChainWrapper<T>> {

    public QueryChainWrapper(Class<T> entityClass, ChainDao chainDao) {
        this(new MergeSegments(), entityClass, chainDao);
    }

    protected QueryChainWrapper(MergeSegments expression, Class<T> entityClass, ChainDao chainDao) {
        super(expression, entityClass, chainDao);
    }

    protected QueryChainWrapper(MergeSegments expression, AtomicInteger paramNameSeq, Class<T> entityClass) {
        super(expression, paramNameSeq, entityClass);
    }

    @Override
    protected String columnToString(String column) {
        return column;
    }

    @Override
    protected String columnSqlInjectFilter(String column) {
        return SqlStringUtil.sqlInjectionReplaceBlank(column);
    }

    @Override
    protected QueryChainWrapper<T> instance() {
        return new QueryChainWrapper<T>(new MergeSegments(), paramNameSeq, entityClass);
    }
}
